//
//  my_set.hpp
//  封装map和set
//
//  Created by 卜绎皓 on 2022/11/17.
//

#pragma once
#include"RedBlackTree.hpp"
 
namespace Bernard
{
    template<class K>
    class set
    {
        //set里面定义内部类重载operator()
        //set的V类型为K
        struct SetKeyOfT
        {
            const K& operator()(const K& key)
            {
                return key;//直接返回key
            }
        };
    public:
        typedef typename RBTree<K, K, SetKeyOfT>::iterator iterator;
        iterator begin()
        {
            return _t.begin();
        }
        iterator end()
        {
            return _t.end();
        }
        pair<iterator, bool> insert(const K& k)
        {
            return _t.Insert(k);
        }
    private:
        RBTree<K, K, SetKeyOfT> _t;
    };
}
